package com.wandian.setting.adapter;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.alibaba.android.arouter.launcher.ARouter;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.mylib.libcore.config.RouterConfig;
import com.mylib.libcore.utils.GlideUtil;
import com.mylib.libcore.utils.UIUtils;
import com.wandian.setting.R;
import com.wandian.setting.bean.CZDataBean;


/**
 * @author Administrator
 * @date 2019/12/16-13:32
 * @description UserInfoCZRecycleAdapter
 **/
public class UserInfoCZRecycleAdapter extends BaseQuickAdapter<CZDataBean, BaseViewHolder> {


    private int number = 0;
    private String isMine;
    public UserInfoCZRecycleAdapter(int layoutResId,String isMine) {
        super(layoutResId);
        this.isMine = isMine;
    }

    @Override
    protected void convert(BaseViewHolder helper, CZDataBean item) {

        TextView tv_cz_title = helper.getView(R.id.tv_cz_title);
        tv_cz_title.setText(item.getTitle()+"");
        TextView tv_cz_time = helper.getView(R.id.tv_cz_time);
        tv_cz_time.setText(item.getClockTime()+"");
        ImageView iv_cz_pic_1 = helper.getView(R.id.iv_cz_pic_1);
        if(!UIUtils.isEmpty(item.getBgImg())){
            iv_cz_pic_1.setVisibility(View.VISIBLE);
            //获取图片真正的宽高
            GlideUtil.intoImg(mContext,item.getBgImg(),iv_cz_pic_1);
        }else {
            iv_cz_pic_1.setVisibility(View.GONE);
        }
        iv_cz_pic_1.setOnClickListener(v -> {
            if(!UIUtils.isEmpty(item)){
                Bundle bundle = new Bundle();
                bundle.putString("file_type","pic");
                bundle.putString("file_path",item.getBgImg());
                ARouter.getInstance().build(RouterConfig.ROUTER_ACTIVITY_CHECK_FILE).with(bundle).navigation();
            }
        });

    }
}
